<?php e($javascript->codeBlock('$(document).ready(function(){$("#the-table").tableSorter();});'));?>
<div id="event-admin">
	
	<div class="action-buttons">
		<?php e($html->link('Add New Event', '/admin/events/add',array('class'=>'add')));?>
		<?php e($html->link('Add New Event Type', '/admin/events/addtype',array('class'=>'add')));?>
	</div>
	
	<table id="the-table">
		<caption>Events on <?php e($sitename);?></caption>
		<colgroup>
			<col id="id" />
			<col id="venue" />
			<col id="address" />
			<col id="datetime" />
			<col id="type" />
			<col id="published" />
			<col id="actions" />
		</colgroup>
		<thead>
			<tr>
				<th scope="col">Event ID</th>
				<th scope="col">Event Venue</th>
				<th scope="col">Event Address</th>
				<th scope="col">Event Date & Time</th>
				<th scope="col">Event Type</th>
				<th scope="col">Published?</th>
				<th scope="col">Actions</th>
			</tr>
		</thead>
		<tbody>
			<?php $row = 0; ?>
			<?php foreach ($events as $event) : ?>
			<tr class="<?php ($row % 2 ? e('even') : e('odd'));?>">
				<td><?php e($event['Event']['id']);?></td>
				<td><?php e($html->link($event['Event']['venue'], '/events/view/' . $event['Event']['id']));?></td>
				<td><?php e($event['Event']['address']);?><br /><?php e($event['Event']['city']);?><br /><?php e($event['Country']['name']);?></td>
				<td><?php e($time->format('D d M Y',$event['Event']['event_date']));?><br /><?php e($event['Event']['event_time']);?></td>
				<td><?php e($event['EventType']['name']);?></td>
				<td><?php ($event['Event']['published'] == 0 ? e('No') : e('Yes'));?></td>
				<td>
					<ul>
						<li><?php e($html->link('Edit', '/admin/events/edit/' . $event['Event']['id'],array('class'=>'edit')));?></li>
						<li><?php e($html->link('Delete', '/admin/events/delete/' . $event['Event']['id'], array('class'=>'delete'), 'Are you sure you wish to delete event ' . $event['Event']['id']));?></li>
					</ul>
				</td>
			</tr>
			<?php $row++; ?>
			<?php endforeach; ?>
		</tbody>
	</table>
</div>